package com.woniuxy.admin.controller;


import com.woniuxy.admin.mapper.PawnShopWarehouseMapper;
import com.woniuxy.admin.service.PawnShopWarehouseService;
import com.woniuxy.core.annotation.Permission;
import com.woniuxy.core.util.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ...
 * @since 2024年05月22日
 */
@RestController
@RequestMapping("/pawnShopWarehouse")
@Api(tags="门店仓管关系管理")
public class PawnShopWarehouseController {
    @Resource
    private PawnShopWarehouseService pawnShopWarehouseService;

    /**
     * 门店绑定仓库
     * @param shopId 门店Id
     * @param warehouseId 仓库Id
     * @return
     */
    @ApiOperation("门店绑定仓库")
    @GetMapping("/bindingShopWarehouse")
    @ApiImplicitParams({
     @ApiImplicitParam(name = "shopId",value ="门店ID" ),
      @ApiImplicitParam(name = "warehouseId",value ="仓库ID" )
    })
    @Permission(roles = {"超级管理员","管理员"})
    public Result bindingShopWarehouse(Integer shopId,Integer warehouseId){
        pawnShopWarehouseService.bindingShopWarehouse(shopId,warehouseId);
        return Result.success("绑定成功",null);
    }

    /**
     * 门店解除仓绑定
     * @param shopId 门店Id
     * @param warehouseId 仓库Id
     * @return
     */
    @ApiOperation("门店解除仓绑定")
    @GetMapping("/cancelBindingShopWarehouse")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "shopId",value ="门店ID" ),
            @ApiImplicitParam(name = "warehouseId",value ="仓库ID" )
    })
    @Permission(roles = {"超级管理员","管理员"})
    public Result cancelBindingShopWarehouse(Integer shopId,Integer warehouseId){
        pawnShopWarehouseService.cancelBindingShopWarehouse(shopId,warehouseId);
        return Result.success("解除绑定成功",null);
    }


}

